package cn.wusifx.zabbix.request.builder.host;

import cn.wusifx.zabbix.request.BaseRequest;
import cn.wusifx.zabbix.request.builder.RequestBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/host/massadd
 */
public class HostMassAddRequestBuilder extends RequestBuilder<Map<String,Object>> {
    private List<Map<String,Object>> hosts;
    public HostMassAddRequestBuilder(String auth) {
        super("host.massadd", auth);
        baseRequest.setParams(new HashMap<>());
    }

    public HostMassAddRequestBuilder(Long id, String auth) {
        super("host.massadd", id, auth);
        baseRequest.setParams(new HashMap<>());
    }

    public List<Map<String, Object>> getHosts() {
        return hosts;
    }

    public HostMassAddRequestBuilder setHosts(List<Map<String, Object>> hosts) {
        this.hosts = hosts;
        return this;
    }

    public HostMassAddRequestBuilder setParam(String key, Object value){
        baseRequest.getParams().put(key,value);
        return this;
    }

    public HostMassAddRequestBuilder setParams(Map<String,Object> params){
        baseRequest.getParams().putAll(params);
        return this;
    }

    @Override
    public BaseRequest<Map<String, Object>> builder() {
        baseRequest.getParams().put("hosts",hosts);
        return baseRequest;
    }
}
